import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

import AutoImport from "unplugin-auto-import/vite";
import Components from "@layui/unplugin-vue-components/vite";
import { LayuiVueResolver } from "@layui/unplugin-vue-components/resolvers";

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [
        LayuiVueResolver({
          importStyle: true,
          resolveIcons: true,
        }),
      ],
    }),
    Components({
      resolvers: [
        LayuiVueResolver({
          resolveIcons: true,
          importStyle: true,
        }),
      ],
    }),
  ],
  server: {
    host: "0.0.0.0",
    port: 8001,
    headers: {
      "access-control-allow-origin": "*",
    },
  },
});
